package com.huage_03;

import java.util.ArrayList;

public class ArrayListDemo03 {
    public static void main(String[] args) {

        ArrayList<Student> array = new ArrayList<>();

        Student std1 = new Student("张三",23);
        Student std2 = new Student("李四",24);
        Student std3 = new Student("王五",25);

        array.add(std1);
        array.add(std2);
        array.add(std3);

        System.out.println("array = " + array);
        for (int i=0;i<array.size();i++){
            Student std = array.get(i);
            System.out.print("学生姓名:" + std.getName());
            System.out.println("  学生年龄:" + std.getAge());
        }
    }
}
